#pragma once
#ifndef OBR_DEFAULTUI_H
#define OBR_DEFAULTUI_H

#include "common.h"
#include "core/Scene.h"
#include "core/Spectrum.h"
#include "helpers/Helpers.h"

namespace OBR
{
/**
 * @brief use OpenCV to display an image
 *
 * @param img
 * @param width
 * @param height
 */
void showImageCV(Spectrum *fbo, int width, int height, std::string name, cv::Mat &window,
                 std::string desc = "desc:\n");

/**
 * @brief use OpenCV to save an image
 *
 * @param img
 * @param width
 * @param height
 */
void saveImageCV(Spectrum *fbo, int width, int height, std::string name);

struct CVMouseHandlerStates
{
    Scene *sc;
    bool right_btn_down = false;
    bool left_btn_down = false;
    bool enable = true;
    float2 prev_pos = make_float2(-1);
    float2 window_size = make_float2(0);
};

class DefaultUI
{
public:
    static cv::Mat window;
    static CVMouseHandlerStates states;

    static void reset(std::string name, uint w, uint h);

    static void show(Scene &sc, std::string name, std::string desc, bool enable_mouse = true);

private:
    static bool initialized;
    static std::string curr_title;
    const static std::string __defualt_ui_window_name;
};
} // namespace OBR

#endif
